<template>
  <div class="accumulated-rewards">
    <div class="rewards-card">
      <div class="rewards-header">
        <div class="header-content">
          <Icon icon="mdi:treasure-chest" class="rewards-icon" />
          <div>
            <h2 class="rewards-title">{{ $t('pages.staking.totalAccumulatedRewards') }}</h2>
            <p class="rewards-subtitle">{{ $t('pages.staking.totalRewards') }}</p>
          </div>
        </div>
      </div>

      <div class="rewards-content">
        <div class="total-rewards">
          <div class="reward-amount-section">
            <div class="primary-amount">
              <span class="krw-amount">{{ formatKRW(totalRewardsKRW) }}</span>
            </div>
            <div class="near-amount">
              <span class="near-value">({{ formatTokenAmount(totalRewardsNEAR, '', 2) }}</span>
              <span class="near-unit">{{ $t('pages.staking.nearToken') }})</span>
            </div>
          </div>
          
          <div class="reward-description">
            <span class="description-text">
              {{ $t('pages.staking.rewardFormat', {
                krw: formatKRW(totalRewardsKRW).replace('₩', '').replace(',', ','),
                near: formatTokenAmount(totalRewardsNEAR, '', 2)
              }) }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Icon } from '@iconify/vue'
import { formatKRW, formatTokenAmount } from '@/utils/currency'

interface Props {
  totalRewardsKRW: number
  totalRewardsNEAR: number
  dailyRewardKRW: number
}

withDefaults(defineProps<Props>(), {
  totalRewardsKRW: 0,
  totalRewardsNEAR: 0,
  dailyRewardKRW: 0
})
</script>

<style scoped lang="scss">
.accumulated-rewards {
  margin-top: 32px;
}

.rewards-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #6ee7b7 100%);
  }
}

.rewards-header {
  margin-bottom: 24px;

  .header-content {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .rewards-icon {
    width: 32px;
    height: 32px;
    color: #10b981;
    flex-shrink: 0;
  }

  .rewards-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 4px 0;
  }

  .rewards-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
  }
}

.rewards-content {
  .total-rewards {
    text-align: center;
    margin-bottom: 32px;

    .reward-amount-section {
      margin-bottom: 16px;

      .primary-amount {
        display: flex;
        align-items: baseline;
        justify-content: center;
        gap: 8px;
        margin-bottom: 8px;

        .krw-amount {
          font-size: 2.5rem;
          font-weight: 800;
          color: #10b981;
          text-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
        }

        .krw-unit {
          font-size: 1.25rem;
          font-weight: 600;
          color: #374151;
        }
      }

      .near-amount {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;

        .near-value {
          font-size: 1.125rem;
          font-weight: 600;
          color: #64748b;
        }

        .near-unit {
          font-size: 1rem;
          font-weight: 500;
          color: #64748b;
        }
      }
    }

    .reward-description {
      .description-text {
        font-size: 1rem;
        color: #374151;
        background: #f1f5f9;
        padding: 12px 20px;
        border-radius: 12px;
        display: inline-block;
      }
    }
  }
}

@media (max-width: 768px) {
  .rewards-card {
    padding: 24px;
  }

  .rewards-header {
    .header-content {
      gap: 12px;
    }

    .rewards-title {
      font-size: 1.25rem;
    }
  }

  .total-rewards {
    .reward-amount-section {
      .primary-amount .krw-amount {
        font-size: 2rem;
      }
    }
  }
}

@media (max-width: 480px) {
  .rewards-card {
    padding: 20px;
  }

  .total-rewards {
    .reward-amount-section {
      .primary-amount .krw-amount {
        font-size: 1.75rem;
      }
    }
  }
}
</style>